(function() {
  var __slice = [].slice;

  define(['handlebars', 'chaplin', 'lib/utils'], function(Handlebars, Chaplin, utils) {
    'use strict';
    var _this = this;
    Handlebars.registerHelper('url', function() {
      var options, params, routeName, _i;
      routeName = arguments[0], params = 3 <= arguments.length ? __slice.call(arguments, 1, _i = arguments.length - 1) : (_i = 1, []), options = arguments[_i++];
      return utils.reverse(routeName, params);
    });
    Handlebars.registerHelper('maskDecimal', function(value) {
      if (!value) {
        return '0,00';
      }
      return value.toFixed(2).replace('.', ',');
    });
    Handlebars.registerHelper('leadingZero', function(number, length) {
      var str;
      if (length == null) {
        length = 2;
      }
      str = '';
      if ((number != null) && number !== "") {
        str = "" + number;
        while (str.length < length) {
          str = '0' + str;
        }
      }
      return new Handlebars.SafeString(str);
    });
    Handlebars.registerHelper('loadTemplate', function(options) {
      var file, fileContent, _ref;
      file = (_ref = options.hash) != null ? _ref.file : void 0;
      fileContent = require("text!" + file);
      return new Handlebars.SafeString(fileContent);
    });
    Handlebars.registerHelper('html', function(content, args) {
      var template;
      if (content == null) {
        content = '';
      }
      if (args == null) {
        args = {};
      }
      template = Handlebars.compile(content);
      return new Handlebars.SafeString(template(args));
    });
    return null;
  });

}).call(this);
